<!--
 * @Description: 相对定位
 * @Author: rendc
 * @Date: 2025-09-16 11:29:26
 * @LastEditors: rendc
 * @LastEditTime: 2025-09-16 11:38:48
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>相对定位</title>
  <style>
    body {
      margin: 0;
    }

    div {
      border: 1px solid red;
      display: inline-block;
      width: 50%;
      height: 300px;
    }

    .right {
      /* 相对定位 相对与自己之前的位置 */
      position: relative;
      /* left: 50%; */
      right: calc(-50% - 1px);
      top: -302px;
    }
  </style>
</head>

<body>
  <div>左</div>
  <div class="right">右</div>
  <div class="">123123</div>
</body>

</html>